//
//  UIView+IBExtension.swift
//  weibo14
//
//  Created by mac on 16/3/3.
//  Copyright © 2016年 mac. All rights reserved.
//
/// 给UIlable 添加几个设置线宽和颜色的方法
import UIKit


extension UIView {


    /// 线宽
    @IBInspectable var borderWidth: CGFloat {
    
        set{
            layer.borderWidth = newValue
        }
        get{
            return layer.borderWidth
        }
    }

    /// 线色
    @IBInspectable var borderColor: UIColor? {
        
        set{
            layer.borderColor = newValue?.CGColor
        }
        get{

            guard let color = layer.borderColor else {
            
            return nil
            }
            return UIColor(CGColor: color)
        }
    }
    

    @IBInspectable var cornerRadius:CGFloat {
    
    
        set{
            layer.cornerRadius = newValue
            layer.masksToBounds = newValue > 0
            
        }
        get{
            return layer.cornerRadius
        }
    
    }
}

